package ch.fusun.baron.data;

import java.util.Collection;

/**
 * A provider of data <br/>
 * Can be listened to and updated
 */
public interface DataProvider {
	/**
	 * Creates an update which updates ALL the data of the data provider
	 * 
	 * @return The Update
	 */
	DataUpdate createFullUpdate();

	/**
	 * Adds a listener listening to changes of the data
	 * 
	 * @param listener
	 *            The listener
	 */
	void addDataListener(DataListener listener);

	/**
	 * Adds the listener if not already present
	 * 
	 * @param listener
	 *            the listener
	 */
	void addDataListenerIfNotAlready(DataListener listener);

	/**
	 * Removes a listener listening to changes of the data
	 * 
	 * @param listener
	 *            The listener
	 */
	void removeDataListener(DataListener listener);

	/**
	 * @return All the listeners
	 */
	Collection<? extends DataListener> getListeners();

	/**
	 * Removes all listeners
	 */
	void removeAllListeners();
}